package chapter3.override;

public class Porint {

	private int x;
	private int y;
	private int z;

	public static void main(String[] args) {
		Porint p = new Porint();
		p.setX(5);
		p.setY(6);
		p.setZ(7);
		System.out.println(p);
		System.out.println(p.sum());

	}

	public Porint() {

	}

	public Porint(int x, int y, int z) {
		this.x = x;
		this.y = y;
		this.z = z;

	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getZ() {
		return z;
	}

	public void setZ(int z) {
		this.z = z;
	}

	public int sum() {
		int sum = x * x + y * y + z * z;
		return sum;
	}

	@Override
	public String toString() {
		return "Porint [x=" + x + ", y=" + y + ", z=" + z + "]";
	}

}
